//不可编辑显示项目已经提交的bug的grid
var testProjectBugGrid = Ext.create('Ext.grid.Panel', {
    store: testProjectBugGridStore,
    title: '测试BUG',
    columns: [new Ext.grid.RowNumberer(), // 显示行号
        {
            text: '名称',
            flex: 1,
            dataIndex: 'title',
            sortable: false
        }, {
            text: '提交人',
            dataIndex: 'authorName',
            flex: 1,
            sortable: false
        }, {
            text: '更新时间',
            dataIndex: 'updateDate',
            flex: 1,
            sortable: false,
            renderer: function (v, m, r) {
                return v == null || v == '' ? '' : v.replace('T', '  ');//使用reset()会分别经历null和空字符串
            }
        }, {
            text: '操作',
            align: 'center',
            sortable: false,
            xtype: 'actioncolumn',
            width: 90,
            items: [{
                icon: 'static/images/icons/fam/look.ico',
                tooltip: '查看详情',
                handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
                    testProjectBugSeeDetailClick(record);
                }
            }]
        }
    ],
    features: [{
        id: 'group',
        ftype: 'groupingsummary',
        groupHeaderTpl: new Ext.XTemplate(
            '对应需求: {[values.name.substring(32)]}'
        ),
        hideGroupedHeader: false,
        enableGroupingMenu: false
    }]
});

//不可编辑的显示bug附件列表的Grid
var testProjectBugAttachedGrid = Ext.create('Ext.grid.Panel', {
    store: testProjectBugAttachedGridStore,
    columns: [new Ext.grid.RowNumberer(), // 显示行号
        {
            text: '名称',
            flex: 1,
            dataIndex: 'name',
            sortable: false
        }, {
            text: '操作',
            align: 'center',
            sortable: false,
            xtype: 'actioncolumn',
            width: 90,
            items: [{
                icon: 'static/images/icons/fam/download.ico',
                tooltip: '下载附件',
                handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
                    if (record.data.isCreate)
                        Ext.Msg.alert('错误', '新附件未保存无法下载！');
                    else
                        fileDownload(zuulUrl + '/' + testServiceName + '/testProject/bug/attach/' + record.data.id);
                }
            }]
        }
    ]
});
